<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - iris.info - data_types/impl/flit.cc</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../index.html">directory</a> - <a href="index.html">data_types/impl</a> - flit.cc</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>iris.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-05-24</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">96</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">62.5 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">60</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :  * =====================================================================================
<span class="lineNum">       3 </span>                :  *
<span class="lineNum">       4 </span>                :  *       Filename:  flit.cc
<span class="lineNum">       5 </span>                :  *
<span class="lineNum">       6 </span>                :  *    Description:  
<span class="lineNum">       7 </span>                :  *
<span class="lineNum">       8 </span>                :  *        Version:  1.0
<span class="lineNum">       9 </span>                :  *        Created:  02/22/2010 03:08:35 PM
<span class="lineNum">      10 </span>                :  *       Revision:  none
<span class="lineNum">      11 </span>                :  *       Compiler:  gcc
<span class="lineNum">      12 </span>                :  *
<span class="lineNum">      13 </span>                :  *         Author:  Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu
<span class="lineNum">      14 </span>                :  *        Company:  Georgia Institute of Technology
<span class="lineNum">      15 </span>                :  *
<span class="lineNum">      16 </span>                :  * =====================================================================================
<span class="lineNum">      17 </span>                :  */
<span class="lineNum">      18 </span>                : 
<span class="lineNum">      19 </span>                : #ifndef  _flit_cc_INC
<span class="lineNum">      20 </span>                : #define  _flit_cc_INC
<span class="lineNum">      21 </span>                : 
<span class="lineNum">      22 </span>                : #include        &quot;flit.h&quot;
<span class="lineNum">      23 </span>                : /*
<span class="lineNum">      24 </span>                :  *--------------------------------------------------------------------------------------
<span class="lineNum">      25 </span>                :  *       Class:  Phit
<span class="lineNum">      26 </span>                :  *      Method:  Phit
<span class="lineNum">      27 </span>                :  * Description:  constructor
<span class="lineNum">      28 </span>                :  *--------------------------------------------------------------------------------------
<span class="lineNum">      29 </span>                :  */
<span class="lineNum">      30 </span><span class="lineCov">         756359 : Phit::Phit ()</span>
<span class="lineNum">      31 </span>                : {
<span class="lineNum">      32 </span><span class="lineNoCov">              0 : }  /* -----  end of method Phit::Phit  (constructor)  ----- */</span>
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span><span class="lineCov">         756278 : Phit::~Phit()</span>
<span class="lineNum">      35 </span>                : {
<span class="lineNum">      36 </span><span class="lineCov">         756278 :     data.clear();</span>
<span class="lineNum">      37 </span><span class="lineCov">        1512556 : }</span>
<span class="lineNum">      38 </span>                : 
<span class="lineNum">      39 </span>                : string
<span class="lineNum">      40 </span><span class="lineNoCov">              0 : Phit::toString () const</span>
<span class="lineNum">      41 </span>                : {
<span class="lineNum">      42 </span><span class="lineNoCov">              0 :     stringstream str;</span>
<span class="lineNum">      43 </span><span class="lineNoCov">              0 :     str &lt;&lt; &quot;Phit: &quot;;</span>
<span class="lineNum">      44 </span><span class="lineNoCov">              0 :     for( int i=data.size() ; i&gt;0 ;i--)</span>
<span class="lineNum">      45 </span><span class="lineNoCov">              0 :         str &lt;&lt; data[i-1];</span>
<span class="lineNum">      46 </span>                : 
<span class="lineNum">      47 </span>                :     str &lt;&lt; endl;
<span class="lineNum">      48 </span><span class="lineNoCov">              0 :     return str.str();</span>
<span class="lineNum">      49 </span>                : }               /* -----  end of function Phit::toString  ----- */
<span class="lineNum">      50 </span>                : 
<span class="lineNum">      51 </span>                : /* Flit Class Impl */
<span class="lineNum">      52 </span><span class="lineCov">         607510 : Flit::Flit()</span>
<span class="lineNum">      53 </span>                : {
<span class="lineNum">      54 </span>                : 
<span class="lineNum">      55 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span><span class="lineCov">         607510 : void Flit::populate_phit_data(vector&lt;bool&gt;* data)</span>
<span class="lineNum">      58 </span>                : {
<span class="lineNum">      59 </span><span class="lineCov">         607510 :     uint no_of_phits = ceil((data-&gt;size() + 0.0)/max_phy_link_bits);</span>
<span class="lineNum">      60 </span>                : //    phits.resize(no_of_phits);
<span class="lineNum">      61 </span><span class="lineCov">        1363869 :     for ( uint i=0; i&lt;no_of_phits; i++)</span>
<span class="lineNum">      62 </span><span class="lineCov">        1512718 :         phits.push_back( new Phit());</span>
<span class="lineNum">      63 </span>                : 
<span class="lineNum">      64 </span><span class="lineCov">        1363869 :     for( uint i=0; i&lt; no_of_phits; i++)</span>
<span class="lineNum">      65 </span>                :     {
<span class="lineNum">      66 </span><span class="lineCov">      182284886 :         for ( uint j=0;j&lt;max_phy_link_bits &amp;&amp; (i*max_phy_link_bits + j)&lt;data-&gt;size(); j++ )</span>
<span class="lineNum">      67 </span><span class="lineCov">      271610856 :             phits[i]-&gt;data.push_back(data-&gt;at(i*max_phy_link_bits + j));</span>
<span class="lineNum">      68 </span>                :     }
<span class="lineNum">      69 </span><span class="lineCov">         607510 : }</span>
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span><span class="lineNoCov">              0 : Flit::~Flit()</span>
<span class="lineNum">      72 </span>                : {
<span class="lineNum">      73 </span>                :     /* 
<span class="lineNum">      74 </span>                :     for( uint i=0; i&lt;phits.size(); i++)
<span class="lineNum">      75 </span>                :         delete(phits.at(i));
<span class="lineNum">      76 </span>                :      * */
<span class="lineNum">      77 </span><span class="lineCov">         607459 : }</span>
<span class="lineNum">      78 </span>                : 
<span class="lineNum">      79 </span><span class="lineNoCov">              0 : string Flit::toString() const</span>
<span class="lineNum">      80 </span>                : {
<span class="lineNum">      81 </span><span class="lineNoCov">              0 :     stringstream str;</span>
<span class="lineNum">      82 </span>                :     str &lt;&lt; &quot;Flit&quot; 
<span class="lineNum">      83 </span>                :         &lt;&lt; &quot;\tFlit type: &quot; &lt;&lt; type
<span class="lineNum">      84 </span><span class="lineNoCov">              0 :         &lt;&lt; endl;</span>
<span class="lineNum">      85 </span>                : 
<span class="lineNum">      86 </span><span class="lineNoCov">              0 :     for ( uint i=0 ; i&lt;phits.size() ; i++ )</span>
<span class="lineNum">      87 </span><span class="lineNoCov">              0 :         str &lt;&lt; phits[i]-&gt;toString();</span>
<span class="lineNum">      88 </span>                : 
<span class="lineNum">      89 </span><span class="lineNoCov">              0 :     return str.str();</span>
<span class="lineNum">      90 </span>                : }
<span class="lineNum">      91 </span>                : 
<span class="lineNum">      92 </span>                : /* HeadFlit Class Impl */
<span class="lineNum">      93 </span><span class="lineCov">         905208 : HeadFlit::HeadFlit()</span>
<span class="lineNum">      94 </span>                : {
<span class="lineNum">      95 </span><span class="lineCov">         301736 :     type = HEAD;</span>
<span class="lineNum">      96 </span><span class="lineCov">         301736 :     src_address = -1;</span>
<span class="lineNum">      97 </span><span class="lineCov">         301736 :     dst_address = -1;</span>
<span class="lineNum">      98 </span><span class="lineCov">         301736 :     transaction_id = -1;</span>
<span class="lineNum">      99 </span><span class="lineCov">         301736 : }</span>
<span class="lineNum">     100 </span>                : 
<span class="lineNum">     101 </span><span class="lineCov">         301699 : HeadFlit::~HeadFlit()</span>
<span class="lineNum">     102 </span>                : {
<span class="lineNum">     103 </span>                : //    phits.clear();
<span class="lineNum">     104 </span><span class="lineCov">        1504434 :     for( uint i=0; i&lt;phits.size(); i++)</span>
<span class="lineNum">     105 </span><span class="lineCov">         450518 :         delete(phits.at(i));</span>
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span><span class="lineCov">         301699 :     control_bits.clear();</span>
<span class="lineNum">     108 </span><span class="lineCov">         301699 :     payload.clear();</span>
<span class="lineNum">     109 </span><span class="lineCov">        1206796 : }</span>
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                : string 
<span class="lineNum">     112 </span><span class="lineNoCov">              0 : HeadFlit::toString() const</span>
<span class="lineNum">     113 </span>                : {
<span class="lineNum">     114 </span><span class="lineNoCov">              0 :     stringstream str;</span>
<span class="lineNum">     115 </span>                :     str &lt;&lt; &quot;HeadFlit&quot;
<span class="lineNum">     116 </span>                :         &lt;&lt; &quot;\tSrc: &quot; &lt;&lt; src_address
<span class="lineNum">     117 </span>                :         &lt;&lt; &quot;\tDst: &quot; &lt;&lt; dst_address
<span class="lineNum">     118 </span>                :         &lt;&lt; &quot;\tTran_id: &quot; &lt;&lt; transaction_id
<span class="lineNum">     119 </span>                :         &lt;&lt; &quot;\t VC: &quot; &lt;&lt; vc
<span class="lineNum">     120 </span>                :         &lt;&lt; &quot;\t length: &quot; &lt;&lt; length
<span class="lineNum">     121 </span>                :         &lt;&lt; &quot;\t control_bits_size: &quot; &lt;&lt; control_bits.size()
<span class="lineNum">     122 </span>                :         &lt;&lt; &quot;\t payload_size: &quot; &lt;&lt; payload.size()
<span class="lineNum">     123 </span>                :         &lt;&lt; &quot;\t msg_class: &quot; &lt;&lt; msg_class
<span class="lineNum">     124 </span><span class="lineNoCov">              0 :         &lt;&lt; endl;</span>
<span class="lineNum">     125 </span>                : 
<span class="lineNum">     126 </span><span class="lineNoCov">              0 :     str &lt;&lt; &quot;Control bits: &quot; ;</span>
<span class="lineNum">     127 </span><span class="lineNoCov">              0 :     for ( uint i=0 ; i&lt;control_bits.size() ; i++ )</span>
<span class="lineNum">     128 </span><span class="lineNoCov">              0 :         str &lt;&lt; control_bits[i] &lt;&lt; &quot; &quot;;</span>
<span class="lineNum">     129 </span>                :     str &lt;&lt; endl;
<span class="lineNum">     130 </span>                : 
<span class="lineNum">     131 </span><span class="lineNoCov">              0 :     for ( uint i=0 ; i&lt;phits.size() ; i++ )</span>
<span class="lineNum">     132 </span><span class="lineNoCov">              0 :         str &lt;&lt; phits[i]-&gt;toString();</span>
<span class="lineNum">     133 </span>                : 
<span class="lineNum">     134 </span><span class="lineNoCov">              0 :     return str.str();</span>
<span class="lineNum">     135 </span>                : }
<span class="lineNum">     136 </span>                : 
<span class="lineNum">     137 </span>                : void
<span class="lineNum">     138 </span><span class="lineCov">         301736 : HeadFlit::populate_head_flit()</span>
<span class="lineNum">     139 </span>                : {
<span class="lineNum">     140 </span>                :     vector&lt;bool&gt; data;
<span class="lineNum">     141 </span><span class="lineCov">        2715624 :     for ( uint i=0; i&lt;max_network_node_bits ; i++ )</span>
<span class="lineNum">     142 </span><span class="lineCov">        2413888 :         data.push_back((src_address &gt;&gt; i)&amp;0x01);</span>
<span class="lineNum">     143 </span>                : 
<span class="lineNum">     144 </span><span class="lineCov">        2715624 :     for ( uint i=0; i&lt;max_network_node_bits ; i++ )</span>
<span class="lineNum">     145 </span><span class="lineCov">        2413888 :         data.push_back((dst_address &gt;&gt; i)&amp;0x01);</span>
<span class="lineNum">     146 </span>                : 
<span class="lineNum">     147 </span><span class="lineCov">        2715624 :     for ( uint i=0; i&lt;max_transaction_id_bits ; i++ )</span>
<span class="lineNum">     148 </span><span class="lineCov">        2413888 :         data.push_back((transaction_id &gt;&gt; i)&amp;0x01);</span>
<span class="lineNum">     149 </span>                : 
<span class="lineNum">     150 </span><span class="lineCov">       10259024 :     for ( uint i=0; i&lt;control_bits.size() ; i++ )</span>
<span class="lineNum">     151 </span><span class="lineCov">        9655552 :         data.push_back(control_bits[i]);</span>
<span class="lineNum">     152 </span>                : 
<span class="lineNum">     153 </span><span class="lineCov">       76814160 :     for ( uint i=0; i&lt;payload.size() ; i++ )</span>
<span class="lineNum">     154 </span><span class="lineCov">       76210688 :         data.push_back(payload[i]);</span>
<span class="lineNum">     155 </span>                : 
<span class="lineNum">     156 </span><span class="lineCov">         301736 :     populate_phit_data(&amp;data);</span>
<span class="lineNum">     157 </span>                :     return;
<span class="lineNum">     158 </span>                : }
<span class="lineNum">     159 </span>                : 
<span class="lineNum">     160 </span>                : /* BodyFlit Class Impl */
<span class="lineNum">     161 </span><span class="lineCov">         305774 : BodyFlit::BodyFlit()</span>
<span class="lineNum">     162 </span>                : {
<span class="lineNum">     163 </span><span class="lineCov">         152887 :     type = BODY;</span>
<span class="lineNum">     164 </span><span class="lineCov">         152887 : }</span>
<span class="lineNum">     165 </span>                : 
<span class="lineNum">     166 </span><span class="lineCov">         152880 : BodyFlit::~BodyFlit()</span>
<span class="lineNum">     167 </span>                : {
<span class="lineNum">     168 </span>                : //    phits.clear();
<span class="lineNum">     169 </span><span class="lineCov">         611520 :     for( uint i=0; i&lt;phits.size(); i++)</span>
<span class="lineNum">     170 </span><span class="lineCov">         152880 :         delete(phits.at(i));</span>
<span class="lineNum">     171 </span><span class="lineCov">         458640 : }</span>
<span class="lineNum">     172 </span>                : 
<span class="lineNum">     173 </span><span class="lineCov">         152880 : TailFlit::~TailFlit()</span>
<span class="lineNum">     174 </span>                : {
<span class="lineNum">     175 </span>                : //    phits.clear();
<span class="lineNum">     176 </span><span class="lineCov">         611520 :     for( uint i=0; i&lt;phits.size(); i++)</span>
<span class="lineNum">     177 </span><span class="lineCov">         152880 :         delete(phits.at(i));</span>
<span class="lineNum">     178 </span><span class="lineCov">         305760 : }</span>
<span class="lineNum">     179 </span>                : 
<span class="lineNum">     180 </span><span class="lineNoCov">              0 : string BodyFlit::toString() const</span>
<span class="lineNum">     181 </span>                : {
<span class="lineNum">     182 </span><span class="lineNoCov">              0 :     stringstream str;</span>
<span class="lineNum">     183 </span>                :     str &lt;&lt; &quot;BodyFlit&quot; 
<span class="lineNum">     184 </span>                :         &lt;&lt; &quot;\tFlit type: &quot; &lt;&lt; type
<span class="lineNum">     185 </span><span class="lineNoCov">              0 :         &lt;&lt; endl;</span>
<span class="lineNum">     186 </span>                : 
<span class="lineNum">     187 </span><span class="lineNoCov">              0 :     for ( uint i=0 ; i&lt;phits.size() ; i++ )</span>
<span class="lineNum">     188 </span><span class="lineNoCov">              0 :         str &lt;&lt; phits[i]-&gt;toString();</span>
<span class="lineNum">     189 </span>                : 
<span class="lineNum">     190 </span><span class="lineNoCov">              0 :     return str.str();</span>
<span class="lineNum">     191 </span>                : }
<span class="lineNum">     192 </span>                : 
<span class="lineNum">     193 </span>                : void
<span class="lineNum">     194 </span><span class="lineCov">         152887 : BodyFlit::populate_body_flit()</span>
<span class="lineNum">     195 </span>                : {
<span class="lineNum">     196 </span>                :     /*  Assumption: 1 body flit = 1phit */
<span class="lineNum">     197 </span><span class="lineCov">         152887 :         populate_phit_data(&amp;bf_data);</span>
<span class="lineNum">     198 </span>                : 
<span class="lineNum">     199 </span>                :     return ;
<span class="lineNum">     200 </span>                : }
<span class="lineNum">     201 </span>                : 
<span class="lineNum">     202 </span>                : /* TailFlit Class Impl */
<span class="lineNum">     203 </span><span class="lineCov">         152887 : TailFlit::TailFlit()</span>
<span class="lineNum">     204 </span>                : {
<span class="lineNum">     205 </span><span class="lineCov">         152887 :     type = TAIL;</span>
<span class="lineNum">     206 </span><span class="lineCov">         152887 :     packet_originated_time = Simulator::Now();</span>
<span class="lineNum">     207 </span><span class="lineCov">         152887 : }</span>
<span class="lineNum">     208 </span>                : 
<span class="lineNum">     209 </span><span class="lineNoCov">              0 : string TailFlit::toString() const</span>
<span class="lineNum">     210 </span>                : {
<span class="lineNum">     211 </span><span class="lineNoCov">              0 :     stringstream str;</span>
<span class="lineNum">     212 </span>                :     str &lt;&lt; &quot;TailFlit&quot;
<span class="lineNum">     213 </span>                :         &lt;&lt; &quot;\tFlit type: &quot; &lt;&lt; type
<span class="lineNum">     214 </span>                :         &lt;&lt; &quot;\tpacket_originated_time: &quot; &lt;&lt; packet_originated_time
<span class="lineNum">     215 </span><span class="lineNoCov">              0 :         &lt;&lt; endl;</span>
<span class="lineNum">     216 </span>                : 
<span class="lineNum">     217 </span><span class="lineNoCov">              0 :     for ( uint i=0 ; i&lt;phits.size() ; i++ )</span>
<span class="lineNum">     218 </span><span class="lineNoCov">              0 :         str &lt;&lt; phits[i]-&gt;toString();</span>
<span class="lineNum">     219 </span>                : 
<span class="lineNum">     220 </span><span class="lineNoCov">              0 :     return str.str();</span>
<span class="lineNum">     221 </span>                : }
<span class="lineNum">     222 </span>                : 
<span class="lineNum">     223 </span>                : void
<span class="lineNum">     224 </span><span class="lineCov">         152887 : TailFlit::populate_tail_flit ()</span>
<span class="lineNum">     225 </span>                : {
<span class="lineNum">     226 </span>                :     vector&lt;bool&gt; data;
<span class="lineNum">     227 </span><span class="lineCov">        1375983 :     for ( uint i=0; i&lt;max_tail_length_bits; i++ )</span>
<span class="lineNum">     228 </span><span class="lineCov">        1223096 :         data.push_back((packet_originated_time &gt;&gt; i)&amp;0x01);</span>
<span class="lineNum">     229 </span>                : 
<span class="lineNum">     230 </span><span class="lineCov">         152887 :     populate_phit_data(&amp;data);</span>
<span class="lineNum">     231 </span>                :     return;
<span class="lineNum">     232 </span><span class="lineCov">              2 : }               /* -----  end of function TailFlit::populate_tail_flit  ----- */</span>
<span class="lineNum">     233 </span>                : 
<span class="lineNum">     234 </span>                : #endif   /* ----- #ifndef _flit_cc_INC  ----- */
<span class="lineNum">     235 </span>                : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
